cmake_minimum_required(VERSION 3.8)
project(GetFilenameComponent)
set(FullFileName "/home/xlll/GetFilenameComponent/CMakeLists.txt.dat")
get_filename_component(directory ${FullFileName} DIRECTORY)
get_filename_component(name ${FullFileName} NAME)
get_filename_component(ext ${FullFileName} EXT)
get_filename_component(name_we ${FullFileName} NAME_WE)
get_filename_component(last_ext ${FullFileName} LAST_EXT)
get_filename_component(name_wle ${FullFileName} NAME_WLE)
get_filename_component(path ${FullFileName} PATH)
message(STATUS "directory = ${directory}")
message(STATUS "name = ${name}")
message(STATUS "ext = ${ext}")
message(STATUS "name_we = ${name_we}")
message(STATUS "last_ext = ${last_ext}")
message(STATUS "name_wle = ${name_wle}")
message(STATUS "path = ${path}")

get_filename_component(absolute_full_path "CMakeLists.txt" ABSOLUTE)
message(STATUS "absolute_full_path = ${absolute_full_path}")
message(STATUS "CMAKE_CURRENT_SOURCE_DIR = ${CMAKE_CURRENT_SOURCE_DIR}")
get_filename_component(absolute_full_path "CMakeLists.txt" ABSOLUTE BASE_DIR "/base_dir")
message(STATUS "absolute_full_path = ${absolute_full_path}")

get_filename_component(real_full_path "./link/CMakeLists.txt.link" REALPATH)
message(STATUS "real_full_path = ${real_full_path}")
get_filename_component(real_full_path "./link/CMakeLists.txt.link" REALPATH BASE_DIR "/base_dir")
message(STATUS "real_full_path = ${real_full_path}")

get_filename_component(program_full_path "CMakeLists.txt arg1 arg2" PROGRAM PROGRAM_ARGS program_args)
message(STATUS "program_full_path = ${program_full_path}")
message(STATUS "program_args = ${program_args}")
